<?php

/**
 * This is the model class for table "sys_netgrow_master".
 *
 * The followings are the available columns in table 'sys_netgrow_master':
 * @property string $netgrow_master_id
 * @property string $netgrow_master_network_id
 * @property string $netgrow_master_sponsor
 * @property string $netgrow_master_node_left
 * @property string $netgrow_master_node_right
 * @property string $netgrow_master_wait_left
 * @property string $netgrow_master_wait_right
 * @property string $netgrow_master_match
 * @property string $netgrow_master_date
 *
 * The followings are the available model relations:
 * @property SysNetwork $netgrowMasterNetwork
 */
class sys_netgrow_master extends CActiveRecord {

    /**
     * Returns the static model of the specified AR class.
     * @return sys_netgrow_master the static model class
     */
    public static function model($className=__CLASS__) {
        return parent::model($className);
    }

    /**
     * @return string the associated database table name
     */
    public function tableName() {
        return 'sys_netgrow_master';
    }

    /**
     * @return array validation rules for model attributes.
     */
    public function rules() {
        // NOTE: you should only define rules for those attributes that
        // will receive user inputs.
        return array(
            array('netgrow_master_network_id, netgrow_master_sponsor, netgrow_master_node_left, netgrow_master_node_right, netgrow_master_wait_left, netgrow_master_wait_right, netgrow_master_match', 'length', 'max' => 10),
            array('netgrow_master_date', 'safe'),
            // The following rule is used by search().
            // Please remove those attributes that should not be searched.
            array('netgrow_master_id, netgrow_master_network_id, netgrow_master_sponsor, netgrow_master_node_left, netgrow_master_node_right, netgrow_master_wait_left, netgrow_master_wait_right, netgrow_master_match, netgrow_master_date', 'safe', 'on' => 'search'),
        );
    }

    /**
     * @return array relational rules.
     */
    public function relations() {
        // NOTE: you may need to adjust the relation name and the related
        // class name for the relations automatically generated below.
        return array(
            'rel_netgrow_master_to_network' => array(self::BELONGS_TO, 'sys_network', 'netgrow_master_network_id'),
        );
    }

    /**
     * @return array customized attribute labels (name=>label)
     */
    public function attributeLabels() {
        return array(
            'netgrow_master_id' => 'Netgrow Master',
            'netgrow_master_network_id' => 'Network',
            'netgrow_master_sponsor' => 'Sponsor',
            'netgrow_master_node_left' => 'Node Left',
            'netgrow_master_node_right' => 'Node Right',
            'netgrow_master_wait_left' => 'Wait Left',
            'netgrow_master_wait_right' => 'Wait Right',
            'netgrow_master_match' => 'Match',
            'netgrow_master_date' => 'Date',
        );
    }

    /**
     * Retrieves a list of models based on the current search/filter conditions.
     * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
     */
    public function search() {
        // Warning: Please modify the following code to remove attributes that
        // should not be searched.

        $criteria = new CDbCriteria;

        $criteria->compare('netgrow_master_id', $this->netgrow_master_id, true);
        $criteria->compare('netgrow_master_network_id', $this->netgrow_master_network_id, true);
        $criteria->compare('netgrow_master_sponsor', $this->netgrow_master_sponsor, true);
        $criteria->compare('netgrow_master_node_left', $this->netgrow_master_node_left, true);
        $criteria->compare('netgrow_master_node_right', $this->netgrow_master_node_right, true);
        $criteria->compare('netgrow_master_wait_left', $this->netgrow_master_wait_left, true);
        $criteria->compare('netgrow_master_wait_right', $this->netgrow_master_wait_right, true);
        $criteria->compare('netgrow_master_match', $this->netgrow_master_match, true);
        $criteria->compare('netgrow_master_date', $this->netgrow_master_date, true);

        return new CActiveDataProvider($this, array(
            'criteria' => $criteria,
        ));
    }

}